package com.mdinfo.system.web;

import com.mdinfo.base.common.bean.CommonResult;
import com.mdinfo.system.param.MenuParam;
import com.mdinfo.system.service.IMenuService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * Created by Administrator on 2017/11/22.
 */
@RestController
//@CrossOrigin
@RequestMapping("/sys/menu")
public class MenuController {

    @Resource
    private IMenuService menuService;

    @RequestMapping("/listAll")
    public CommonResult<?> listAll(){
        return menuService.listAll();
    }

    @RequestMapping("/listQuery")
    public CommonResult<?> listQuery(@Valid MenuParam.ListQueryParam param){
        return menuService.listQuery(param);
    }

    @RequestMapping("/usable")
    public CommonResult<?> usable(@Valid MenuParam.UsableParam param){
        return menuService.usable(param);
    }

    @RequestMapping("/disable")
    public CommonResult<?> disable(@Valid MenuParam.DisableParam param){
        return menuService.disable(param);
    }

    @RequestMapping("/delete")
    public CommonResult<?> delete(@Valid MenuParam.DeleteParam param){
        return menuService.delete(param);
    }

    @RequestMapping("/add")
    public CommonResult<?> add(@Valid MenuParam.AddParam param){
        return menuService.add(param);
    }

    @RequestMapping("/modify")
    public CommonResult<?> modify(@Valid MenuParam.ModifyParam param){
        return menuService.modify(param);
    }

    @RequestMapping("/listUsableAll")
    public CommonResult<?> listUsableAll(){
        return menuService.listUsableAll();
    }

    @RequestMapping("/test")
    public CommonResult<?> test(){
        return menuService.test();
    }
}
